﻿using Furion.DependencyInjection;
using System.Text.RegularExpressions;

namespace PrivateTracker.Service.Application;
/// <summary>
/// 客户端服务
/// </summary>
public class ClientService : IClientService, ITransient
{
    /// <summary>
    /// 是否允许的客户端
    /// </summary>
    /// <returns></returns>
    public async Task<bool> IsAllowClinet(string client)
    {
        bool b = false;
        string[] patteron = { "^uTorrent/", "^Azureus ", "^BitComet/", "^qBittorrent/", "^Transmission/", "^BiglyBT" };
        foreach (var item in patteron)
        {
            if (Regex.IsMatch(client, item))
            {
                b = true;
                break;
            }
        }
        return await Task.FromResult(b);
    }
}
